<p-dialog header="（注：* 为必填项）" [(visible)]="display" modal="modal" [responsive]="true" [width]="800" [minWidth]="200" (onHide)="closePersonEditMask(false)">
  <p-panel header="{{title}}">
    <div class="ui-grid ui-grid-responsive ui-grid-pad ui-fluid" style="margin: 10px 0px">
      <form [formGroup]="person">
        <div class="ui-grid-row margin-bottom-1vw">
          <div class="ui-grid-col-6" id="">
            <label for="" >
              姓名：
              <span class="start_red">*</span>
            </label>
            <input class="cursor_not_allowed"
                   type="text" formControlName="perName"
                   pInputText *ngIf="state ==='add'" id="" [style.width.%]="75"/>
            <input class="cursor_not_allowed"
                   type="text" formControlName="perName"
                   pInputText [(ngModel)]="currentPer.name" *ngIf="state ==='update'" id="" [style.width.%]="75"/>

          </div>
          <div class="ui-grid-col-6" id="schduleCreater">
            <label for="" >
              帐号：
              <span class="start_red">*</span>
            </label>
            <input  class="cursor_not_allowed"
                    formControlName="pid"
                    type="text" pInputText *ngIf="state ==='add'" id=""
                    [style.width.%]="75"/>
            <input  class="cursor_not_allowed"
                    formControlName="pid"
                    type="text" pInputText [(ngModel)]="currentPer.pid" *ngIf="state ==='update'" id=""
                    [style.width.%]="75" readonly/>
          </div>
        </div>
        <div class="ui-grid-row" *ngIf="!person.controls['perName'].untouched && (!person.controls['perName'].valid) || (!person.controls['pid'].valid)">
            <div class="ui-grid-col-6 " *ngIf="!person.controls['perName'].untouched && (!person.controls['perName'].valid)">
                <div class="ui-message ui-messages-error ui-corner-all "  *ngIf="person.hasError('required','perName')&&(!person.controls['perName'].untouched)">
                  <i class="fa fa-close"></i>
                  姓名必填
                </div>
                <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="!person.hasError('required','perName')&&person.hasError('name','perName')&&(!person.controls['perName'].untouched)" >
                  <i class="fa fa-close"></i>
                  {{person.getError('name', 'perName')?.descxxx}}
                </div>
            </div>
            <div class="ui-grid-col-6"  *ngIf="!person.controls['pid'].valid">
                <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="person.hasError('required','pid')&&(!person.controls['pid'].untouched)" >
                    <i class="fa fa-close"></i>
                    帐号必填
                </div>
                <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="!person.hasError('required','pid')&&person.hasError('code','pid')&&(!person.controls['pid'].untouched)" >
                    <i class="fa fa-close"></i>
                    {{person.getError('code', 'pid')?.descxxx}}
                </div>
            </div>
        </div>


        <div class="ui-grid-row margin-bottom-1vw">
          <div class="ui-grid-col-6" >
            <label for="" >
              密码：
              <span class="start_red">*</span>
            </label>
            <input class="cursor_not_allowed"
                   type="password" formControlName="pwd"
                   pInputText *ngIf="state ==='add'" [style.width.%]="75"
            />
            <input class="cursor_not_allowed"
                   type="password" formControlName="pwd"
                   pInputText [(ngModel)]="currentPer.pwd" *ngIf="state ==='update'"  [style.width.%]="75" readonly
            />
          </div>
          <div class="ui-grid-col-6" id="sex">
            <label>性别：</label>
            <p-radioButton name="group1" value="男" label="男" formControlName="sex" inputId="opt1" *ngIf="state ==='add'"></p-radioButton>
            <p-radioButton name="group1" value="男" label="男" formControlName="sex" inputId="opt1" [(ngModel)]="currentPer.sex" *ngIf="state ==='update'"></p-radioButton>
            <p-radioButton name="group1" value="女" label="女" formControlName="sex"  inputId="opt1" *ngIf="state ==='add'"></p-radioButton>
            <p-radioButton name="group1" value="女" label="女" formControlName="sex"  inputId="opt1" [(ngModel)]="currentPer.sex" *ngIf="state ==='update'"></p-radioButton>
          </div>
        </div>
        <div class="ui-grid-row margin-bottom-1vw"
             *ngIf="!person.controls['pwd'].untouched && (!person.controls['pwd'].valid) && state ==='add'">
          <div class="ui-grid-col-6">
            <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="person.hasError('required','pwd')&&(!person.controls['pwd'].untouched)">
              <i class="fa fa-close"></i>
              密码必填
            </div>
            <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="!person.hasError('required','pwd')&&(!person.hasError('minLength','pwd')||!person.hasError('maxLength','pwd')||!person.hasError('password','pwd'))&&(!person.controls['pwd'].untouched)" >
              <i class="fa fa-close"></i>
              密码长度必须不少于6
            </div>
            <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="!person.hasError('required','pwd')&&(!person.hasError('minLength','pwd')&&!person.hasError('maxLength','pwd')||!person.hasError('password','pwd'))&&(!person.controls['pwd'].untouched)" >
              <i class="fa fa-close"></i>
              密码长度必须不大于18
            </div>
            <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="!person.hasError('required','pwd')&&(!person.hasError('minLength','pwd')&&!person.hasError('maxLength','pwd')||!person.hasError('password','pwd'))&&(!person.controls['pwd'].untouched)" >
              <i class="fa fa-close"></i>
              {{person.getError('password', 'pwd')?.descxxx}}
            </div>
          </div>
        </div>
        <div class="ui-grid-row margin-bottom-1vw">
          <div class="ui-grid-col-6" >
            <label for="" >
              身份证：
            </label>
            <input class="cursor_not_allowed"
                   type="text" formControlName="idcard"
                   pInputText *ngIf="state ==='add'"  [style.width.%]="75" (change)="idcardChange($event)"/>
            <input class="cursor_not_allowed"
                   type="text" formControlName="idcard"
                   pInputText [(ngModel)]="currentPer.idcard" *ngIf="state ==='update'"  [style.width.%]="75" (change)="idcardChange($event)"/>

          </div>
          <div class="ui-grid-col-6" >
            <label for="" >
              生日：
            </label>
            <p-calendar [showIcon]="true" dateFormat="yy-mm-dd" [(ngModel)]="currentPer.birthday"  *ngIf="state ==='add'" [style.width.%]="75" ngClass="birthday" formControlName="birthday"></p-calendar>
            <p-calendar [showIcon]="true" dateFormat="yy-mm-dd" [(ngModel)]="currentPer.birthday" *ngIf="state ==='update'" [style.width.%]="75" ngClass="birthday" formControlName="birthday"></p-calendar>
          </div>
        </div>
        <div class="ui-grid-row margin-bottom-1vw"
             *ngIf="!person.controls['idcard'].untouched && (!person.controls['idcard'].valid)">
          <div class="ui-grid-col-6">
            <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="person.hasError('idcard','idcard')&&(!person.controls['idcard'].untouched)">
              <i class="fa fa-close"></i>
              非法的身份证号
            </div>
          </div>
        </div>
        <div class="ui-grid-row margin-bottom-1vw">
          <div class="ui-grid-col-4">
            <label for="" >
            </label>
            <label for="" >
              组织：
              <span class="start_red">*</span>
            </label>
            <input class="cursor_not_allowed"
                   type="text" formControlName="organization"
                   pInputText [(ngModel)]="currentPer.label"  [style.width.%]="65" readonly/>
          </div>
          <div class="ui-grid-col-1">
            <button pButton  type="button" (click)="showAddInspectionPlanMask()" label="选择"></button>
          </div>
          &nbsp;
          <div class="ui-grid-col-1">
            <button pButton  type="button" (click)="clearTreeDialog()" label="清空"></button>
          </div>
          <div class="ui-grid-col-6">
            <!--<label for="">职位</label>-->
            <label for="" >
              职位：
            </label>
            <input  class="cursor_not_allowed"
                    formControlName="post"
                    type="text" pInputText *ngIf="state ==='add'"
                    [style.width.%]="75"/>
            <input  class="cursor_not_allowed"
                    formControlName="post"
                    type="text" pInputText [(ngModel)]="currentPer.post" *ngIf="state ==='update'"
                    [style.width.%]="75"/>
          </div>
        </div>
        <div class="ui-grid-row margin-bottom-1vw">
          <div class="ui-grid-col-6">
            <label for="" >
              手机：
              <span class="start_red">*</span>
            </label>
            <input class="cursor_not_allowed"
                   type="text" formControlName="mobile"
                   pInputText *ngIf="state ==='add'" [style.width.%]="75"
            />
            <input class="cursor_not_allowed"
                   type="text" formControlName="mobile"
                   pInputText [(ngModel)]="currentPer.mobile" *ngIf="state ==='update'" [style.width.%]="75"
            />

          </div>
          <div class="ui-grid-col-6">
            <label for="" >
              电话：
            </label>
            <input  class="cursor_not_allowed"
                    formControlName="tel"
                    type="text" pInputText *ngIf="state ==='add'"
                    [style.width.%]="75"/>
            <input  class="cursor_not_allowed"
                    formControlName="tel"
                    type="text" pInputText [(ngModel)]="currentPer.tel" *ngIf="state ==='update'"
                    [style.width.%]="75"/>
          </div>
        </div>
        <div class="ui-grid-row margin-bottom-1vw"
             *ngIf="!person.controls['mobile'].untouched && (!person.controls['mobile'].valid || !person.controls['tel'].valid)">
          <div class="ui-grid-col-6">
            <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="person.hasError('required','mobile')">
              <i class="fa fa-close"></i>
              手机号必填
            </div>
            <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="!person.hasError('required','mobile')&&person.hasError('phone','mobile')" >
              <i class="fa fa-close"></i>
              {{person.getError('phone', 'mobile')?.descxxx}}
            </div>
          </div>
          <div class="ui-grid-col-6">
            <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="person.hasError('phone','tel')&&!person.controls['tel'].untouched" >
              <i class="fa fa-close"></i>
              非法的电话号码
            </div>
          </div>
        </div>
        <div class="ui-grid-row margin-bottom-1vw">
          <div class="ui-grid-col-6">
            <label for="" >
              邮箱：
            </label>
            <input class="cursor_not_allowed"
                   type="text" formControlName="email"
                   pInputText *ngIf="state ==='add'" [style.width.%]="75"/>
            <input class="cursor_not_allowed"
                   type="text" formControlName="email"
                   pInputText [(ngModel)]="currentPer.email" *ngIf="state ==='update'"  [style.width.%]="75"
            />

          </div>
          <div class="ui-grid-col-6">
            <label for="" >
              微信号：
            </label>
            <input  class="cursor_not_allowed"
                    formControlName="wechat"
                    type="text" pInputText *ngIf="state ==='add'"
                    [style.width.%]="75"/>
            <input  class="cursor_not_allowed"
                    formControlName="wechat"
                    type="text" pInputText [(ngModel)]="currentPer.wechat" *ngIf="state ==='update'"
                    [style.width.%]="75"/>
          </div>
        </div>
        <div class="ui-grid-row margin-bottom-1vw"
             *ngIf="!person.controls['email'].untouched && !person.controls['email'].valid">
          <div class="ui-grid-col-6">
            <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="person.hasError('email','email')">
              <i class="fa fa-close"></i>
              非法的邮箱
            </div>
          </div>
        </div>
        <div class="ui-grid-row margin-bottom-1vw" formGroupName="dateGroup">
          <div class="ui-grid-col-6" >
            <label for="" >
              注册日期：
            </label>
            <p-calendar [showIcon]="true" [maxDate]="maxDate" dateFormat="yy-mm-dd" *ngIf="state ==='add'" [style.width.%]="75" ngClass="birthday" formControlName="registedate" [(ngModel)]="registedate" dataType="string"></p-calendar>
            <p-calendar [showIcon]="true" dateFormat="yy-mm-dd" [(ngModel)]="currentPer.registedate" *ngIf="state ==='update'" [style.width.%]="75" ngClass="birthday" formControlName="registedate" dataType="string" disabled="true"></p-calendar>
          </div>
          <div class="ui-grid-col-6" >
            <label for="" >
              失效日期：
            </label>
            <p-calendar [showIcon]="true" [minDate]="minDate" dateFormat="yy-mm-dd" *ngIf="state ==='add'" [style.width.%]="75" ngClass="birthday" formControlName="validdate" dataType="string"></p-calendar>
            <p-calendar [showIcon]="true" [minDate]="minDate" dateFormat="yy-mm-dd" [(ngModel)]="currentPer.validdate" *ngIf="state ==='update'" [style.width.%]="75" ngClass="birthday" formControlName="validdate" dataType="string"></p-calendar>
          </div>
        </div>
        <div class="ui-grid-row margin-bottom-1vw">
          <div class="ui-grid-col-6">
            <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="person.hasError('date','dateGroup')">
              <i class="fa fa-close"></i>
              {{person.getError('date','dateGroup')?.descxxx}}
            </div>
          </div>
        </div>
        <div class="ui-grid-row margin-bottom-1vw">
          <div class="ui-grid-col-12 addr">
            <label for="" >
              地址：
            </label>
            <input class="cursor_not_allowed"
                   type="text" formControlName="addr"
                   pInputText *ngIf="state ==='add'"  [style.width.%]="88"
            />
            <input class="cursor_not_allowed"
                   type="text" formControlName="addr"
                   pInputText [(ngModel)]="currentPer.addr" *ngIf="state ==='update'"  [style.width.%]="88"
            />

          </div>
        </div>
        <div class="ui-grid-row margin-bottom-1vw">
          <div class="ui-grid-col-6">
            <label for="" >图片一：</label>
            <label class="upload_item">
              <span class="img_btn">上传图片</span>
              <input type="file"  value="选择文件" class="file_upload" id="upimg_1" (change)="fileChange($event,1)"/>
              <img [src]="imgUrl_1" alt="" class="imgage_preview">
            </label>
          </div>
          <div class="ui-grid-col-6">
            <label for="">图片二：</label>
            <label class="upload_item">
              <span class="img_btn">上传图片</span>
              <input type="file"  value="选择文件" class="file_upload" id="upimg_1" (change)="fileChange($event,2)"/>
              <img [src]="imgUrl_2" alt="" class="imgage_preview">
            </label>
          </div>
        </div>
        <div class="ui-grid-row margin-bottom-1vw">
          <div class="ui-grid-col-12 addr">
            <label for="" >备注：</label>
            <input class="cursor_not_allowed"
                   type="text" formControlName="remark1"
                   pInputText *ngIf="state ==='add'" id="" [style.width.%]="88"
            />
            <input class="cursor_not_allowed"
                   type="text" formControlName="remark1"
                   pInputText [(ngModel)]="currentPer.remark1" *ngIf="state ==='update'" id="" [style.width.%]="88"
            />

          </div>
        </div>
        <div class="ui-grid-row margin-bottom-1vw"
             *ngIf="!person.controls['remark1'].untouched && !person.controls['remark1'].valid">
          <div class="ui-grid-col-6">
            <div class="ui-message ui-messages-error ui-corner-all"  *ngIf="!person.hasError('maxLength','remark1')">
              <i class="fa fa-close"></i>
              不超过100字符
            </div>
          </div>
        </div>
        <div class="ui-grid-row margin-bottom-1vw">
          <div class="ui-grid-col-8"></div>
          <div class="ui-grid-col-2 padding-tblr">
            <button pButton type="submit" label="确认" (click)="formSubmit(false)" [disabled]="!person.controls['perName'].valid || !person.controls['pid'].valid || !person.controls['pwd'].valid || !person.controls['mobile'].valid" *ngIf="state ==='add'"></button>
            <button pButton type="submit" label="确认" (click)="formSubmit(false)" [disabled]="!person.controls['perName'].valid || !person.controls['pid'].valid || !person.controls['mobile'].valid" *ngIf="state ==='update'"></button>
          </div>
          <div class="ui-grid-col-2 padding-tblr">
            <button pButton type="button" label="取消" (click)="closePersonEditMask(false)"></button>
          </div>

        </div>
      </form>

    </div>
  </p-panel>
</p-dialog>
<app-add-inspection-plan-tree
  *ngIf="showAddPlanMask"
  (closeAddMask)="closeAddPlanTreeMask($event)"
  (addTree)="addPlanOrg($event)">
</app-add-inspection-plan-tree>
